Repository navigation
feat(sdk): make DPoP discovery cache TTL configurable - #442
Draft
dmihalcik-virtru wants to merge 1 commit into
Draft
dmihalcik-virtru wants to merge 1 commit into
dmihalcik-virtru wants to merge 1 commit into
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
1 of 3 tasks
Adds SDKBuilder.dpopDiscoveryCacheTtl(Duration) so deployments whose KAS, gateway, or IdP change on their own schedule can shorten, lengthen, or disable (Duration.ZERO) the AUTO-mode discovery cache. Null or negative values are rejected. The default stays at five minutes; the 30 s legacy fallback after an inconclusive discovery is capped at the TTL. Verified: DPoPModeTest (42, incl. new zero-TTL and builder validation checks), SDKBuilderTest (12) and TokenSourceTest (22) pass offline with JDK 21. Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com> Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
dmihalcik-virtru
force-pushed
the
DSPX-5640-java-sdk-dpop-cache-ttl
branch
from
November 16, 2026 14:18
d4c5b8b to
e369d92
Compare
This was referenced Nov 16, 2026
dmihalcik-virtru
marked this pull request as draft
November 17, 2026 04:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #441. Review and merge that first; this PR's base will retarget to
mainonce it lands.Summary
Adds
SDKBuilder.dpopDiscoveryCacheTtl(Duration)to control how long a server's DPoP htu style, discovered inDPoPMode.AUTO, is reused before the SDK discovers it again.Duration.ZEROturns the cache off, so every request first fetches the server's well-known documents.nullor a negative duration throwsIllegalArgumentException, the same waydpopMode(null)does.LEGACY/RFC9449modes.Rationale
The KAS, gateway and IdP can be upgraded or reconfigured on their own schedules. Deployments that change often, or that need answers to be picked up immediately, can shorten the TTL or turn the cache off. Stable deployments can lengthen it to avoid re-running discovery.
This is split out from #441 because #441 is a patch, while this adds public API.
Public API
SDKBuilder.dpopDiscoveryCacheTtl(Duration). The change is additive.Test plan
DPoPModeTest: a new test checks that a zero TTL runs discovery on every request, including after the RFC 9449 mode is recorded from bootstrap. The builder-validation test now also checks thatnulland negative values are rejected and thatZEROis accepted.mvn -o -pl sdk test -Dtest='DPoPModeTest,SDKBuilderTest,TokenSourceTest'. DPoPModeTest: 26 passed. SDKBuilderTest: 12 passed. TokenSourceTest: 22 passed.